package com.cq.hd.common.enums.biz;

import lombok.Getter;

/**
 * @description: 计算佣金类型(0 - 无, 1 - 固定佣金, 2 - 固定佣金比例 ， 3 - 专属佣金比例)
 * @author: mYunYu
 * @date: 2021/8/23 14:28
 * @version: v1.0
 */
public enum CalCommissionTypeEnum {

    NO(0, "无"),
    FIX_COMMISSION(1, "固定佣金"),
    FIX_COMMISSION_RATE(2, "固定佣金比例"),
    EXCLUSIVE_COMMISSION(3, "专属佣金比例"),
    ;

    @Getter
    private final Integer value;

    @Getter
    private final String name;

    CalCommissionTypeEnum(Integer value, String name) {
        this.value = value;
        this.name = name;
    }

    public static CalCommissionTypeEnum typeOf(Integer value) {
        CalCommissionTypeEnum[] values = CalCommissionTypeEnum.values();
        for (CalCommissionTypeEnum v : values) {
            if (v.value.equals(value)) {
                return v;
            }
        }
        return null;
    }

    public static CalCommissionTypeEnum typeOf(String name) {
        CalCommissionTypeEnum[] values = CalCommissionTypeEnum.values();
        for (CalCommissionTypeEnum v : values) {
            if (v.name.equals(name)) {
                return v;
            }
        }
        return null;
    }

}
